<div class="fsh-rightPanel wxmp-index">
    <div class="layui-anim layui-anim-upbit">
        <blockquote class="layui-elem-quote layui-bg-red" style="border: 0;">
            <p>
                当前版本为V1.0,如需要了解更多,请访问俊宝官网
                <a href="http://www.baidu.com" style="color: #fff;text-decoration: underline;">访问官网</a>
            </p>
        </blockquote>
        <!--        <blockquote class="layui-elem-quote layui-bg-red hide" id="index-update" style="border: 0;">
                    <p>
                        系统已升级，请升级本系统，让我们将继续为您服务。
                        <a href="https://gitee.com/qingfengtaizi/wxmp" style="color: #fff;text-decoration: underline;">马上升级</a>
                    </p>
                </blockquote>-->
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md6">
                <div class="panel panel-default">
                    <div class="panel-heading">环境信息</div>
                    <div class="panel-body" id="index-environment">
                        <table class="layui-table">
                            <colgroup>
                                <col width="170">
                                <col>
                            </colgroup>
                            <tbody>
                            <tr>
                                <td>JAVA版本:</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>MYSQL版本</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>WEB服务器</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>CPU个数</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>虚拟机内存总量</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>虚拟机空闲内存量</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>虚拟机使用的最大内存量</td>
                                <td></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="panel panel-default" style="min-height: 386px;">
                    <div class="panel-heading">系统信息</div>
                    <div class="panel-body" id="index-stytem">
                        <table class="layui-table">
                            <colgroup>
                                <col width="150">
                                <col>
                            </colgroup>
                            <tbody>
                            <tr>
                                <td>客户端IP：</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>服务器IP</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>操作系统</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>用户主目录</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>工作目录</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>系统目录</td>
                                <td></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>更新日志</legend>
        </fieldset>
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <ul class="layui-timeline">
                            <li class="layui-timeline-item">
                                <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                                <div class="layui-timeline-content layui-text">
                                    <h3 class="layui-timeline-title">2019/6/10</h3>
                                    <p>
                                        V1.0.0 版本上线
                                        <br>版本上线，包含基础功能及公众号配置
                                        <br>公众号回调消息处理能力
                                        <br>公众号"增粉"活动上线
                                    </p>
                                </div>
                            </li>
                            <br/>
                            <li class="layui-timeline-item">
                                <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                                <div class="layui-timeline-content layui-text">
                                    <h3 class="layui-timeline-title">2019/6/5</h3>
                                    <p>后台框架上线</p>
                                    <ul>
                                        <li>框架搭建</li>
                                        <li>基础功能实现</li>
                                    </ul>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {

        var systemVersion = null;
        var systemUpdateTime = null;
        var systemName = null;
        //获取系统环境信息
        $.ajax({
            url: '/manage/index',
            success: function (result) {
                if (result.success) {
                    renderHtml({
                        targetId: 'index-environment',
                        template: "environment",
                        htmlData: result,
                    });
                    renderHtml({
                        targetId: 'index-stytem',
                        template: "stytem",
                        htmlData: result,
                    });
                    systemName = result.data.systemName;
                    systemVersion = result.data.systemVersion;
                    systemUpdateTime = result.data.systemUpdateTime;
                    checkUpdate();
                }
            }
        });

        function checkUpdate() {
            $.getJSON("https://www.smartwx.info/newVersion?callback=?", function (result) {
                if (systemVersion && result.LAST_SYSTEM_VERSION) {
                    //渲染版本信息
                    result.systemName = systemName;
                    result.systemVersion = systemVersion;
                    result.systemUpdateTime = systemUpdateTime;
                    renderHtml({
                        targetId: 'index-version',
                        template: "version",
                        htmlData: result,
                    });
                    var local = systemVersion.split(".");
                    var last = result.LAST_SYSTEM_VERSION.split(".");
                    if (hasnew(local[0], last[0])) {
                        newCallback();
                    } else if (local[0] == last[0]) {
                        if (hasnew(local[1], last[1])) {
                            newCallback();
                        } else if (local[1] == last[1] && hasnew(local[2], last[2])) {
                            newCallback();
                        }
                    }
                }

                function hasnew(a, b) {
                    return parseInt(b) > parseInt(a)
                }

                function newCallback() {
                    $("#index-update").removeClass("hide");
                }
            });
        }
    });
</script>
